﻿using Ewell.BizComponent.UI.Main.ViewModel;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Ewell.BizComponent.UI.Main.Windows
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : MetroWindow
    {
        public LoginVm loginVm { get; set; }
        public LoginWindow()
        {
            InitializeComponent();
            loginVm=new LoginVm();
            loginVm.mainWindow = this;
            this.DataContext= loginVm;
        }

        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {

        }

        private void TextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            loginVm.code= (sender as TextBox).Text.Trim();
            loginVm.QueryHospital.Execute(this);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.loginVm.passWord = pwdBox.Password;
            loginVm.Login.Execute(this);
        }
    }
}
